if objectP(window gWizWindow) then forget window gWizWindow
end stopMovie
on closeWindow
set myName = the movieName
set offS = offset( ".dir", myName )
if offS then
delete char offS to (offS + 4) of myName
end if
forget window myName
end closeWindow
on validateUserSelection
set gCurrentSprite = 24 --starting sprite to copy
set gFrameCountMin = 5
set gFrameCountMax = 15
set mySprite = gCurrentSprite
set myFlag = TRUE
set gSpriteCount = 0
--1st, see how many channels we need for our selection
repeat while myFlag = TRUE
if the type of sprite mySprite = 0 then
if the type of sprite (mySprite + 1) = 0 then --we're done
set myFlag = FALSE
exit repeat
else --we're not done, we have a valid channel, so count it
set gSpriteCount = gSpriteCount + 1
set mySprite = mySprite + 1
end if
else -- we have a valid channel, so count it
set gSpriteCount = gSpriteCount + 1
set mySprite = mySprite + 1
end if
end repeat
if gSpriteCount = 1 then set gSpritePhrase = "channel"
else set gSpritePhrase = "channels"
--next, get the user's selection
tell the stage
set gUserSelection = the scoreSelection
end tell
--next check to see if selection is the right size
if gUserSelection = [] then --has a selection been made?
alert "Please click in the score where you want the widget to begin, then try again. You need " && gSpriteCount && "sprite" && gSpritePhrase && "and at least" && gFrameCountMin && "frames. "
abort
end if
set gStartSprite = getAt(getAt(gUserSelection, 1), 1)
set myEndSprite = (gStartSprite + gSpriteCount) - 1
set gStartFrame = getAt(getAt(gUserSelection, 1), 3)
set myEndFrame = (gStartFrame + gFrameCountMax) - 1
if gStartSprite < 1 then --does selection start > 0?
alert "Your selection must start in sprite channel 1 or greater. Please make a new selection and try again."
abort
end if
tell the stage --Check the selection, is it empty?
repeat with y = gStartFrame to myEndFrame
set myFrameCounter = y - gStartFrame
go to frame y
repeat with z = gStartSprite to myEndSprite
if the type of sprite z <> 0 then --we have something in the selection, alert not valid!
--check to see where we are btwn gFrameCountMin and gFrameCountMax
if myFrameCounter < gFrameCountMin then --we don't have enough frames free to write widget.
alert "This selection contains something already. You need " && gSpriteCount && "sprite" && gSpritePhrase && "and at least" && gFrameCountMin && "frames. Please click in the score where you want the widget to begin, then try again."
abort
else --we have enough empty frames to write the widget
set gFrameCountMax = myFrameCounter
set myEndFrame = myFrameCounter - 1 --this should bump us out of frameCount repeat
exit repeat
end if
end if
end repeat
end repeat
go to frame gStartFrame
end tell
copyButtonPrime
end validateUserSelection
on copyButtonPrime
cursor 4
--initialize widget for copying
go the frame + 1
go the frame - 1
--initialize our vars and lists
set myMemberNum = 1 --starting castMember to look at for copying
set PasteInfoList = []
set mySpriteList = [ ]
set myWidgetScriptList = []
set myAssocPasteList = []
-- set myRedundantFlag = FALSE
repeat with x = gCurrentSprite to ((gCurrentSprite + gSpriteCount) - 1)
--find out what i have to copy... me, myAssociates, myscript